Skip to content

Conversation

@crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Dec 17, 2025

Follow-up to #142469

  • Add pixi infrastructure for
    • freethreading: compiles with --disable-gil
    • tsan-freethreading: compiles with --disable-gil --with-thread-sanitizer
  • Refactor recipes:
    • Make recipe.yaml and pixi.toml all identical symlinks
    • Remove clang-19 since we are not building the experimental jit
    • Remove ld_impl because we are not hacking the makefiles
    • Add site_packages_path

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste of asan/pixi.toml

script:
file: ../build.sh
env:
PYTHON_VARIANT: "free-threading"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste of asan/recipe.yaml, except this one line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste of asan/pixi.toml

script:
file: ../build.sh
env:
PYTHON_VARIANT: "tsan"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste of asan/recipe.yaml, except this one line

@lucascolley
Copy link
Contributor

@kumaraditya303 @lucascolley any idea what's wrong here?

no clue sorry I haven't seen this before

@crusaderky crusaderky marked this pull request as draft December 17, 2025 12:10
@crusaderky crusaderky changed the title WIP pixi builds for free-threading and tsan WIP pixi builds for free-threading and TSAN Dec 17, 2025
@crusaderky
Copy link
Contributor Author

The tsan crash is due to the default mmap_rnd_bits on Ubuntu 24.04; it goes away after lowering it:

$ sudo sysctl vm.mmap_rnd_bits
vm.mmap_rnd_bits = 32  # too high
$ sudo sysctl vm.mmap_rnd_bits=28  # reduce it
vm.mmap_rnd_bits = 28

ubuntu-latest github actions workers seems to be unaffected.

@hugovk hugovk changed the title WIP pixi builds for free-threading and TSAN gh-143120: WIP pixi builds for free-threading and TSAN Dec 23, 2025
@hugovk
Copy link
Member

hugovk commented Dec 23, 2025

There's a lot of copy/paste here, which can make maintenance harder. Does pixi have some concept of code reuse or parametrisation? Maybe not the best example, but something like GitHub Actions' reusable workflows?

@hugovk hugovk added the infra CI, GitHub Actions, buildbots, Dependabot, etc. label Dec 23, 2025
@ngoldbaum
Copy link
Contributor

@lucascolley is there anything we can do right now to reduce the duplication here? Or does that require fixes in pixi?

@lucascolley
Copy link
Contributor

As mentioned in the README already, this is blocked on prefix-dev/pixi#4599.

Copy link
Contributor

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue which is needed to make this mergeable. I'm also playing with a NumPy recipe based on this.

- `asan`: ASan-instrumented build with `PYTHON_ASAN=1`
- `free-threading`
- `asan`: ASan-instrumented build
- `tsan`: free-threading, TSan-instrumented build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be called tsan-free-threading. There should probably also be an asan-free-threading. @lucascolley is there a way to avoid the combinatorial explosion of variants here? Ideally you'd be able to somehow combine these but I think that's probably not tenable at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the answer to this is no because of prefix-dev/pixi#4599
Barring the above, we could write a template + generation script and then commit the output to git? Very ugly if you ask me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would vote for keeping things simple but verbose at the minute until there is a proper solution upstream

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to tsan-free-threading

@crusaderky crusaderky marked this pull request as ready for review January 2, 2026 16:05
@crusaderky crusaderky changed the title gh-143120: WIP pixi builds for free-threading and TSAN gh-143120: pixi builds for free-threading and TSAN Jan 2, 2026
@lucascolley
Copy link
Contributor

can you try this diff Guido?

Maybe I did something wrong, but I attempted to apply this patch over at ngoldbaum@39df6fe and then updated numpy at ngoldbaum/numpy@d28bebc and it doesn't seem to work, unfortunately, at least on my local setup. CI will test it when a runner picks it up:

numpy/numpy/actions/runs/20754129965/job/59591290742?pr=30510

doh should have checked the CI log earlier, it is working! Just worked locally for me too

@ngoldbaum
Copy link
Contributor

doh should have checked the CI log earlier, it is working! Just worked locally for me too

Oh hey, it worked! That's so strange - I wonder what's different on my setup. It looks like pixi is up-to-date...

@lucascolley
Copy link
Contributor

if in doubt try pixi clean, maybe something is being cached that shouldn't be

@ngoldbaum
Copy link
Contributor

if in doubt try pixi clean, maybe something is being cached that shouldn't be

Nope, doesn't work. Here's the build log after pixi clean and pixi clean cache: https://gist.github.com/ngoldbaum/8ade90dd534410c6c13e349f23e2d077

The only difference I see compared with the working build on CI is that my build used uv 0.9.22 but the CI build used 0.9.21.

@ngoldbaum
Copy link
Contributor

Nope, doesn't work. Here's the build log after pixi clean and pixi clean cache: https://gist.github.com/ngoldbaum/8ade90dd534410c6c13e349f23e2d077

This ended up coming down to there being a .pixi folder in the pixi-packages/tsan-free-threading subfolder of my numpy clone. pixi clean didn't remove it and it took me a while to realize it was actually in a subfolder. Sorry for all the noise on that.

isuruf and others added 9 commits January 8, 2026 14:14
- Remove clang-19 since we are not building the experimental jit
- Remove ld_impl because we are not hacking the makefiles
- Add site_packages_path
- Make recipe.yaml identical with just the variant name difference
- Add a generate.sh to generate recipe.yaml from default variant
- Add a runtime requirement of libsanitizer for gcc
@crusaderky crusaderky marked this pull request as draft January 14, 2026 15:27
@lucascolley
Copy link
Contributor

looks great, prefix-dev/pixi-build-backends#532 should get us down to a single recipe.yaml, and hopefully in a future Pixi release once we can select a variant/build string we can get down to a single pixi.toml. Seems like the latter is blocked on prefix-dev/pixi#5248.

@isuruf
Copy link
Contributor

isuruf commented Jan 14, 2026

Are symbolic links allowed? (Especially since these files end up in the python source distribution, it might be bad because of windows). If not we might have to duplicate the files.

Copy link
Contributor

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we update the README to point to the new blockers for using a single manifest and recipe per #142872 (comment) ?

@crusaderky
Copy link
Contributor Author

Tested all builds on pixi 0.62.2 Linux x64 against ngoldbaum/numpy#4

@isuruf at the end of the numpy build I get

│ │ ⚠ warning Overdepending against python_abi

but I can't figure out if it's actually a problem or what it is about; could you investigate?

@crusaderky crusaderky marked this pull request as ready for review January 15, 2026 13:04
--oldincludedir="${BUILD_PREFIX}/${HOST}/sysroot/usr/include" \
--enable-shared \
--srcdir="${SRC_DIR}" \
--with-system-expat \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isuruf not sure what this is about?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we install expat from conda, this tells cpython to use that.

@isuruf
Copy link
Contributor

isuruf commented Jan 15, 2026

@isuruf at the end of the numpy build I get
│ │ ⚠ warning Overdepending against python_abi
but I can't figure out if it's actually a problem or what it is about; could you investigate?

You can ignore it. Harmless warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review infra CI, GitHub Actions, buildbots, Dependabot, etc. skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants